package cate.game.train.rune.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "徽章进阶的请求")
@OperationSetter(GDOperation.RUNE_GRADE_UP)
public class RuneGradeUpReq implements MsgInput {
    @NoteField("食灵uid")
    public String heroUid;
    @NoteField("徽章uid")
    public String runeUid;
    @NoteField("穿戴位置")
    public byte pos;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = game.train.rune.gradeUp(cc.getRole(), heroUid, runeUid, pos);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.RUNE_GRADE_UP_REQ;
    }
}
